package com.xxkj.nmip.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.xxkj.nmip.R;
import com.xxkj.nmip.utils.ColorUtil;

public class ChooseDialog extends Dialog implements View.OnClickListener {
    private TextView titleTxt1;
    private TextView titleTxt2;
    private TextView cancelTxt;
    private View submit_mid_line;

    private Context mContext;
    private String content;
    private OnCloseListener listener;
    private String positiveName;
    private String negativeName;
    private String title;

    public ChooseDialog(Context context) {
        super(context);
        this.mContext = context;
    }

    public ChooseDialog(Context context, int themeResId, String content) {
        super(context, themeResId);
        this.mContext = context;
        this.content = content;
    }

    public ChooseDialog(Context context, int themeResId, String content, OnCloseListener listener) {
        super(context, themeResId);
        this.mContext = context;
        this.content = content;
        this.listener = listener;
    }


    protected ChooseDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        this.mContext = context;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_choose);
        setCanceledOnTouchOutside(false);
        initView();
    }

    private void initView() {
        titleTxt1 = (TextView) findViewById(R.id.text1);
        titleTxt2 = (TextView) findViewById(R.id.text2);
        cancelTxt = (TextView) findViewById(R.id.text3);
        titleTxt1.setOnClickListener(this);
        titleTxt2.setOnClickListener(this);
        cancelTxt.setOnClickListener(this);


    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.text1:
                if (listener != null) {
                    listener.onClick(this, true,"1");
                }
                this.dismiss();
                break;
            case R.id.text2:
                if (listener != null) {
                    listener.onClick(this, true,"2");
                }
                break;
            case R.id.text3:
                if (listener != null) {
                    listener.onClick(this, true,"3");
                }
                break;
        }
    }

    public interface OnCloseListener {
        void onClick(Dialog dialog, boolean confirm, String content);
    }
}